import GLOBAL_VARIABLE from '@/public/config/GlobalConfig';

/**
 * 登录获取token和刷新token接口
 */
export const login = (params = null) => {
	return new Promise((resolve, reject) => {
		uni.request({
			method: 'POST',
			url: GLOBAL_VARIABLE.apiUrl.loginApi + '/rbac/oauth2/token',
			data: {
				...params,
				client_id: GLOBAL_VARIABLE.loginConfig.client_id
			},
			header: {
				'Content-Type': 'application/x-www-form-urlencoded'
			},
			dataType: 'json',
			success: ({
				data
			}) => {
				resolve(data);
			},
			fail: (err) => {
				reject(err)
			},
		})
	})

}

/**
 * 获取行政区数据
 */
export const getRegions = (data = null) => {
	return uni.$http.get('/system/regions', data)
}